from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

web = Chrome(executable_path='D:/驱动/c/chromedriver.exe')
web.set_window_size(1200, 800)

web.get('https://www.lagou.com/')

web.find_element(By.CSS_SELECTOR, '#cboxClose').click()
web.find_element(By.CSS_SELECTOR, '#search_input').click()
web.find_element(By.CSS_SELECTOR, '#search_input').send_keys('python')
web.find_element(By.CSS_SELECTOR, '#search_input').send_keys(Keys.ENTER)


list_YibNq = web.find_elements(By.CSS_SELECTOR, '#jobList .list__YibNq .item__10RTO')
# print(len(list_YibNq))
# print(list_YibNq)
for item in list_YibNq:
    title = item.find_element(By.XPATH, './div[1]/div[1]/div[1]/a').text

    time = item.find_element(By.XPATH, './div[1]/div[1]/div[1]/span').text

    # money = item.find_element(By.XPATH, './div[1]/div[1]div[2]/span').text

    print(title, time)



web.close()